using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace SolarWinds.Particles
{
    public struct BillboardParticleElement
    {
        private Vector3 mPosition;
        private Vector2 mTextureCoordinate;
        private Color mColor;
        private Vector4 mData;

        public Vector3 Position
        {
            get { return mPosition; }
            set { mPosition = value; }
        }
        public Vector2 TextureCoordinate
        {
            get { return mTextureCoordinate; }
            set { mTextureCoordinate = value; }
        }
        public Vector4 Data
        {
            get { return mData; }
            set { mData = value; }
        }
        public Color Color
        {
            get { return mColor; }
            set { mColor = value; }
        }

        public float SpriteSize
        {
            get { return mData.X; }
            set { mData.X = value; }
        }
        public float AlphaValue
        {
            get { return mData.Y; }
            set { mData.Y = value; }
        }

        public BillboardParticleElement(Vector3 position, Vector2 textureCoordinate, Color color, float size, float alpha)
        {
            mPosition = position;
            mTextureCoordinate = textureCoordinate;
            mData = new Vector4(size, alpha, 0.0f, 0.0f);
            mColor = color;
        }

        static public VertexElement[] VertexElements = 
            { 
                new VertexElement(0,0,VertexElementFormat.Vector3,VertexElementMethod.Default,VertexElementUsage.Position,0),
                new VertexElement(0,4*3,VertexElementFormat.Vector2,VertexElementMethod.Default,VertexElementUsage.TextureCoordinate,0),                
                new VertexElement(0,4*5,VertexElementFormat.Color ,VertexElementMethod.Default,VertexElementUsage.Color,0),
                new VertexElement(0,4*6,VertexElementFormat.Vector4,VertexElementMethod.Default,VertexElementUsage.Position,1),
            };

        public static int SizeInBytes = (3 + 2 + 1 + 4) * 4;
    }
}